package com.easy.mapper;

import com.easy.bean.Appointment;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface AppointmentMapper {

    int insert(Appointment appointment);

    Appointment one(@Param("id") Integer id);

    /**
     * 我的挂号列表（只查未删除的预约）
     * 返回字段：id, doctor_id, schedule_id, status, doctor_name, title, department_id, time_slot
     */
    List<Map<String, Object>> myList(@Param("user_id") Integer userId);

    /**
     * 逻辑删除预约（取消）
     */
    int logicalDelete(@Param("id") Integer id, @Param("user_id") Integer userId);

    /**
     * 校验某条预约是否属于当前用户且未删除
     */
    int countByIdAndUser(@Param("id") Integer id, @Param("user_id") Integer userId);
}
